
package com.yyf.springboot2.common;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtil {
	
//	public static boolean isEmpty(String text){
//		boolean flag = true;
//		if (text!=null&&!text.equals("")){
//			flag = false;
//		}
//		return flag;
//	}
	
	 /**
     * 验证字符串是否有字符
     */
    public static boolean hasText(String text) {
        if (text == null) return false;
        for (int i = 0; i < text.length(); i++) {
            if (!Character.isWhitespace(text.charAt(i))) return true;
        }
        return false;
    }

    public static boolean isEmpty(String text) {
        return text == null || text.trim().isEmpty();
    }

    public static boolean isNotEmpty(String text) {
        return text != null && text.trim().length() > 0;
    }


    /**
     * 替换掉所有空格
     */
    public static String replaceBlank(String text) {
        if (text == null) {
            return null;
        }
        return text.replaceAll("\\s", "");
    }

/*    *//**
     * 生成客户端机器身份验证码
     *//*
    public static byte[] genCertif(String identifier, byte[] iv) throws Exception {
        String str = identifier + "1315Xx$";
        byte[] idbytes = str.getBytes();
        byte[] newB = new byte[iv.length + idbytes.length];
        System.arraycopy(idbytes, 0, newB, 0, idbytes.length);
        System.arraycopy(iv, 0, newB, idbytes.length, iv.length);
        return MD5Util.Md5_16(newB);
    }
*/
    private StringUtil() {
    }

}

